#ifndef IMAGESAVEMANAGER_H
#define IMAGESAVEMANAGER_H

#include <QObject>
#include <QString>
#include <opencv2/opencv.hpp>
#include <QDateTime>
#include "quicktool.h"
class ImageSaveManager : public QObject {
    Q_OBJECT

public:
    static ImageSaveManager& getInstance();

    GLOBAL_QML_STATE_PROPERTY(float , probability , 0.1); //保存概率 0-1
    GLOBAL_QML_STATE_PROPERTY(bool , isEnableSave , false); //保存是否
    // 禁止复制构造和赋值
    ImageSaveManager(const ImageSaveManager&) = delete;
    ImageSaveManager& operator=(const ImageSaveManager&) = delete;

    Q_INVOKABLE void saveImage();
    // 保存图像的接口
    void saveImage(const cv::Mat& image, int id, float probability_ = 0);

    const QString saveDir = "master/logoSave/" ;
    const QString ext = ".jpg";
private:
    // 私有构造函数
    ImageSaveManager(QObject* parent = nullptr);

    QString generateFilePath(int id);
    // 计数器
    int sequenceNumber;

    QString configName = "Default";
};

#endif // IMAGESAVEMANAGER_H
